package com.linxianqin.webClient.config;

import io.netty.channel.ChannelOption;
import io.netty.handler.timeout.ReadTimeoutHandler;
import io.netty.handler.timeout.WriteTimeoutHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.reactive.ClientHttpConnector;
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
import org.springframework.http.client.reactive.ReactorResourceFactory;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.netty.http.client.HttpClient;

import java.util.function.Function;


/**
 * @author lxq
 * @version 1.0
 * @description: TODO
 * @date 2021/1/16 16:30
 */
@Slf4j
@Configuration
public class WebClientConfig {


    /**
     * 但是，如果服务器可以启动或停止进程内(例如，作为 WAR 部署的 Spring MVC 应用程序)，
     * 则可以声明ReactorResourceFactory和globalResources=true(默认值)类型的 Spring 托管 bean，
     * 以确保 Reactor Netty 全局 SpringApplicationContext关闭时，资源将关闭
     * @return ReactorResourceFactory
     */
    @Bean
    public ReactorResourceFactory reactorResourceFactory() {
        return new ReactorResourceFactory();
    }
}
